package logic

import (
	"context"
	"goods/models/mysql"

	"goods/goodsrpc/goodsrpc"
	"goods/goodsrpc/internal/svc"

	"github.com/zeromicro/go-zero/core/logx"
)

type CommentShowLogic struct {
	ctx    context.Context
	svcCtx *svc.ServiceContext
	logx.Logger
}

func NewCommentShowLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CommentShowLogic {
	return &CommentShowLogic{
		ctx:    ctx,
		svcCtx: svcCtx,
		Logger: logx.WithContext(ctx),
	}
}

func (l *CommentShowLogic) CommentShow(in *goodsrpc.CommentShowRequest) (*goodsrpc.CommentShowResponse, error) {
	// todo: add your logic here and delete this line

	var comment mysql.Comment
	mysql.DB.Debug().Find(&comment)
	return &goodsrpc.CommentShowResponse{
		CommentId: int64(comment.ID),
		Context:   comment.Context,
		UserId:    comment.UserId,
		GoodsId:   comment.GoodsId,
	}, nil
}
